package org.luxor.eshop.account.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.luxor.eshop.account.entity.AccountEntity;

import java.math.BigDecimal;

/**
 * 账户
 *
 * @author administrator @date 2020-12-04 15:47:45
 */
@Mapper
public interface AccountMapper extends BaseMapper<AccountEntity> {

    /**
     * 获取账户详情记录
     *
     * @param account 账户编号
     * @return 账户详情
     */
    AccountEntity selectByAccount(String account);

    /**
     * 冻结,预付款金额
     *
     * @param amounts        要预冻的金额
     * @param paymentAccount 付款账号
     */
    void preparePayment(@Param("amounts") BigDecimal amounts, @Param("paymentAccount") String paymentAccount);

    /**
     * 确认付款金额
     *
     * @param amounts        要解除的预冻结金额
     * @param paymentAccount 付款账号
     */
    void commitPayment(@Param("amounts") BigDecimal amounts, @Param("paymentAccount") String paymentAccount);

    /**
     * 取消冻结的预付款金额
     *
     * @param amounts        要取消的预冻结金额
     * @param paymentAccount 付款账号
     */
    void rollbackPayment(@Param("amounts") BigDecimal amounts, @Param("paymentAccount") String paymentAccount);

    /**
     * 收到，未达的收款金额
     *
     * @param amounts        未到账的金额
     * @param receiptAccount 收款账号
     */
    void prepareReceipt(@Param("amounts") BigDecimal amounts, @Param("receiptAccount") String receiptAccount);

    /**
     * 确认，到账的收款金额
     *
     * @param amounts        确认已到账的金额
     * @param receiptAccount 收款账号
     */
    void commitReceipt(@Param("amounts") BigDecimal amounts, @Param("receiptAccount") String receiptAccount);

    /**
     * 回滚，未达的收款金额
     *
     * @param amounts        预冻结金额
     * @param receiptAccount 收款账号
     */
    void rollbackReceipt(@Param("amounts") BigDecimal amounts, @Param("receiptAccount") String receiptAccount);
}
